<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.min.js"></script>
    
</head>
<body>
    <div id="app">
      函数读取：{{getStrByBirthday()}}
      <hr>
      函数读取：{{getStrByBirthday()}}
      <hr>
      计算属性调用：{{getStrByBirthday2}}
      <hr>
      计算属性调用：{{getStrByBirthday2}}
    </div>
    <script>
        const app = new Vue({
            el:"#app",
            data:{
                birthday:1429038888888
            },
            computed:{
                getStrByBirthday2(){
                    console.log("getStrByBirthday2 be called !");
                    var d = new Date(this.birthday);
                    return d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
                }
            },
            methods:{
                getStrByBirthday(){
                    console.log("getStrByBirthday be called !");
                    var d = new Date(this.birthday);
                    return d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
                }
            }
        })
    </script>
</body>
</html>